<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="erp" uri="/erp-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<link rel="stylesheet"
	href="<%=basePath%>script/jquery-ui-1.10.4/themes/base/jquery.ui.all.css">
<script src="<%=basePath%>script/jquery-ui-1.10.4/jquery-1.10.2.js"></script>
<script src="<%=basePath%>script/jquery-ui-1.10.4/ui/jquery.ui.core.js"></script>
<script
	src="<%=basePath%>script/jquery-ui-1.10.4/ui/jquery.ui.widget.js"></script>
<script
	src="<%=basePath%>script/jquery-ui-1.10.4/ui/jquery.ui.button.js"></script>
<script src="<%=basePath%>script/script.js"></script>
<link rel="stylesheet"
	href="<%=basePath%>script/jquery-ui-1.10.4/demos/demos.css">
<link rel="stylesheet" href="<%=basePath%>style/style.css">
<script>
	$(function() {
		init_list_page();
	});

	function gotoPage(pageIndex) {
		window.location.href = "topic_list.action?forum.id=" + ${id}
				+ "&page.pageIndex=" + pageIndex;
	}
</script>
</head>
<body>
	<div class="center">
		<div class="list_container">
			<h1 class="catalogue">
				<s:a action="forum_list">版块列表</s:a>
				&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;
				<s:a action="topic_list?forum.id=%{id}">${name}</s:a>
			</h1>
			<s:a action="topic_addPage?forum.id=%{id}" cssClass="a_add_topic">发表新帖</s:a>
			<table class="ui-widget ui-widget-content">
				<thead>
					<tr class="ui-widget-header ">
						<th>类型</th>
						<th>标题</th>
						<th>作者</th>
						<th>跟帖数</th>
						<th>上次回复</th>
						<th>回复时间</th>
						<th colspan="3">操作</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.topicList">
						<tr>
							<td><s:if test="%{articleType.toString()=='TYPE_TOP'}">置顶帖</s:if>
								<s:elseif test="%{articleType.toString()=='TYPE_BEST'}">精华帖 </s:elseif>
								<s:elseif test="%{articleType.toString()=='TYPE_COMMON'}">普通帖 </s:elseif></td>
							<td><s:a action="reply_list?topicId=%{id}">${title}</s:a></td>
							<td>${author.name}</td>
							<td>${replyCount}</td>
							<td>${lastReply.author.name}</td>
							<td><s:date name="%{lastUpdateTime}"
									format="yyyy年MM月dd日 HH点mm分" /></td>
							<td><erp:link url="topic_delete" value="删帖" params="id"
									attr="class:a_delete" /></td>
							<td><s:if test="%{articleType.toString()=='TYPE_TOP'}">
									<erp:link url="topic_setTypeCommon" value="取消置顶" params="id"
										attr="class:a_removeType" />
								</s:if> <s:else>
									<erp:link url="topic_setTypeTop" value="置顶" params="id"
										attr="class:a_setType" />
								</s:else></td>
							<td><s:if test="%{articleType.toString()=='TYPE_BEST'}">
									<erp:link url="topic_setTypeCommon" value="取消精华" params="id"
										attr="class:a_removeType" />
								</s:if> <s:else>
									<erp:link url="topic_setTypeBest" value="设为精华" params="id"
										attr="class:a_setType" />
								</s:else></td>
						</tr>
					</s:iterator>
				</tbody>
			</table>

			<!-- 分页信息 -->
			<br />
			<%@include file="/WEB-INF/jsp/public/pageController.jsp"%>
			<br /> <br />

		</div>
	</div>
</body>
</html>
